

import 'package:todo_app/thirdpart/flutter_fms/flutter_fms.dart';
import 'package:todo_app/utils/call/CallHelper.dart';
import 'package:todo_app/utils/call/states/ConnectingState.dart';
import 'package:todo_app/utils/call/states/IdleState.dart';

class CallConnectTransition extends ITransition {

  CallConnectTransition({ ConnectingState? connectingState }) : super(toState: connectingState);

  @override
  bool check() {
    if(toState == null || fromState == null) return false;
    if(fromState is ConnectingState) {
      if((fromState as ConnectingState).context?.requestSuccess == false) return true;
    }
    if(fromState is IdleState){
      CallHelper.pushLocalMessageNotice();
      return true;
    } 
    return false;
  }

  @override
  bool? onCompleteCallBack() => null;

  @override
  String get name => "CallConnectTransition";
}